home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Snippets / Devices / CDTool / cd.h < prev    next >
Encoding:
Text File  |  1990-09-14  |  2.7 KB  |  148 lines  |  [TEXT/MPS ]

  1. // imWare
  2. // Wednesday, February 14, 1990
  3. // James Beninghaus
  4.  
  5. #ifndef __FILES__
  6.     #include    <Files.h>
  7. #endif
  8. #ifndef __DEVICES__
  9.     #include    <Devices.h>
  10. #endif
  11.  
  12. #define csWhoIsThere    97
  13. #define csReadTOC        100
  14. #define csATrkSearch    103
  15. #define csAPlay            104
  16. #define csAPause        105
  17. #define csAStop            106
  18. #define csAStatus        107
  19.  
  20. #define BLOCKADDR        0
  21. #define    MSFADDR            1
  22. #define TRACKADDR        2
  23.  
  24. #define TOCTRACKS        1
  25. #define TOCENDOFDISK    2
  26. #define TOCSTARTADDR    3
  27.  
  28. #define STEREO            9
  29. #define MONO            15
  30.  
  31. #define START            0
  32. #define STOP            1
  33.  
  34. #define PAUSE            1
  35. #define CONTINUE        0
  36.  
  37. #define    PLAYING            0
  38. #define    PAUSED            1
  39.  
  40. typedef    unsigned char    Byte;
  41. typedef unsigned short    Word;
  42. typedef    unsigned long    Long;
  43.  
  44. typedef struct WhoIsThereRec {
  45.     ParamBlockHeader
  46.     short        ioRefNum;
  47.     short        csCode;
  48.     struct {
  49.         Byte    fill;
  50.         Byte    SCSIMask;
  51.     } csParam;
  52. } WhoIsThereRec;
  53.  
  54. typedef struct AStatusRec {
  55.     ParamBlockHeader
  56.     short        ioRefNum;
  57.     short        csCode;
  58.     struct {
  59.         Byte    audioStatus;
  60.         Byte    playMode;
  61.         Byte    cntlField;
  62.         Byte    minutes;
  63.         Byte    seconds;
  64.         Byte    frames;
  65.     } csParam;
  66. } AStatusRec;
  67.  
  68. typedef struct {
  69.     Byte        cntlField;
  70.     Byte        minutes;
  71.     Byte        seconds;
  72.     Byte        frames;
  73. } StartAddrRec;
  74.  
  75. typedef struct ReadTOCRec {
  76.     ParamBlockHeader
  77.     short        ioRefNum;
  78.     short        csCode;
  79.     union {
  80.         Word    type;
  81.         Byte    addr[3];
  82.         struct {
  83.             Word    fill;
  84.             Long    data;
  85.             Word    length;
  86.             Byte    track;
  87.         } buffer;
  88.     } csParam;
  89. } ReadTOCRec;
  90.  
  91. typedef struct APlayRec {
  92.     ParamBlockHeader
  93.     short        ioRefNum;
  94.     short        csCode;
  95.     struct {
  96.         Word    type;
  97.         Byte    addr[4];
  98.         Word    startStop;
  99.         Byte    fill;
  100.         Byte    playMode;
  101.     } csParam;
  102. } APlayRec;
  103.  
  104. typedef struct ATrkSearchRec {
  105.     ParamBlockHeader
  106.     short        ioRefNum;
  107.     short        csCode;
  108.     struct {
  109.         Word    type;
  110.         Byte    addr[4];
  111.         Word    playFlag;
  112.         Byte    fill;
  113.         Byte    playMode;
  114.     } csParam;
  115. } ATrkSearchRec;
  116.  
  117. typedef struct AStopRec {
  118.     ParamBlockHeader
  119.     short        ioRefNum;
  120.     short        csCode;
  121.     struct {
  122.         Word    type;
  123.         Byte    addr[4];
  124.     } csParam;
  125. } AStopRec;
  126.  
  127. typedef struct APauseRec {
  128.     ParamBlockHeader
  129.     short        ioRefNum;
  130.     short        csCode;
  131.     struct {
  132.         Long    state;
  133.     } csParam;
  134. } APauseRec;
  135.  
  136. void            Usage        (void);
  137. pascal    Byte    Decimal2BCD    (Byte n);
  138. pascal    Byte    BCD2Decimal    (Byte n);
  139. pascal    OSErr    EjectCD        (short ioRefNum);
  140. pascal    OSErr    OpenCD        (Byte CDDrive, short *ioRefNum);
  141. pascal    OSErr    APlay        (short ioRefNum, Byte startTrack, Byte playMode);
  142. pascal    OSErr    APause        (short ioRefNum, Long state);
  143. pascal    OSErr    AStop        (short ioRefNum, Byte stopTrack);
  144. pascal    OSErr    ATrkSearch    (short ioRefNum, Byte track, Byte playFlag, Byte playMode);
  145. pascal    OSErr    AStatus        (short ioRefNum, Byte *audioStatus, Byte *playMode, Byte *cntlField, Byte *minutes, Byte *seconds, Byte *frames);
  146. pascal    OSErr    TrackCount    (short ioRefNum, Byte *lastTrack);
  147. pascal    OSErr    TrackInfo    (short ioRefNum, Byte track, Byte *cntlField, Byte *minutes, Byte *seconds, Byte *frames);
  148.